package cn.gdk.gaodekecc.service.impl;

import cn.gdk.gaodekecc.domain.Product;
import cn.gdk.gaodekecc.mapper.ProductMapper;
import cn.gdk.gaodekecc.service.IProductService;
import cn.gdk.gaodekecc.util.StrUtils;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author director
 * @since 2022-11-19
 */
@Service
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements IProductService {
    @Autowired
    private  ProductMapper mapper;
    @Value("${lssue.threshold}")
    private  Long threshold;
    @Value("${lssue.process}")
    private  Long pro;
    @Override
    public void saveproduct(Product product) {
        String sn = product.getSn();
        Product pro = mapper.findBySn(sn);
        if(pro==null){
            String sn1 = StrUtils.getRandomString(10);
            product.setSn(sn1);
            mapper.insert(product);
        }

    }
}
